package com.tdcoding.chat.helper;

import java.util.Arrays;


public class Logger {
	private static StringBuffer logBuffer=new StringBuffer();
	
	public static void println(Object classes,String method,Object... objs){
		logBuffer.setLength(0);
		if (classes==null) {
			classes="nothing";
		}
		else if (classes instanceof String) {
			classes=classes.toString();
		}
		else {
			classes=classes.getClass().getSimpleName();
		}
		if (method==null) {
			method="nothing";
		}
		if(objs==null)
			logBuffer.append("nothing");
		else{
			for (Object object : objs) {
				logBuffer.append(object+"【】");
			}
		}
		System.out.println("【"+classes.toString()+"："+method+"】【】"+logBuffer.toString());
	}
	
	public static void printBytes(Object classes,String method,byte[] bytes){
		if (classes==null) {
			classes="nothing";
		}
		else if (classes instanceof String) {
			classes=classes.toString();
		}
		else {
			classes=classes.getClass().getSimpleName();
		}
		if (method==null) {
			method="nothing";
		}
		System.out.println("【"+classes.toString()+"】【"+method+"】【"+Arrays.toString(bytes)+"】");
	}
}
